<template>
    <div>
        <Form :model="formItem" inline>
            <FormItem>
                <Input v-model="formItem.company" placeholder="单位"></Input>
            </FormItem>
            <FormItem>
                <Button type="success" @click="search()">搜索</Button>
            </FormItem>
            <FormItem>
                <Button type="primary" @click="exportData">导出</Button>
            </FormItem>
        </Form>
        <Table border :columns="columns12" :data="data6" ref="table">
<!--            <template slot-scope="{ row }" slot="name">-->
<!--                <strong>{{ row.name }}</strong>-->
<!--            </template>-->
            <template slot-scope="{ row }" slot="acceptance_organization">
                <strong>{{ row.acceptance_organization }}</strong>
            </template>
<!--            <template slot-scope="{ row, index }" slot="action">-->
<!--                <Button type="primary" size="small" style="margin-right: 5px" @click="show(index)">核查</Button>-->
<!--            </template>-->
        </Table>
        <Modal v-model="modal2" width="760">
            <p slot="header" style="color:#f60;text-align:center">
                <!--                <Icon type="ios-information-circle"></Icon>-->
                <span>核查</span>
            </p>
            <div style="text-align:center">
                <Row>
                    <Col span="2" style="margin-top: 5px">
                        检查情况
                    </Col>
                    <Col span="15">
                        <Input v-model="value"/>
                    </Col>
                </Row>
                <Row style="margin-top: 20px">
                    <Col span="2">
                        结果
                    </Col>
                    <Col span="15">
                        <Input v-model="value7" type="textarea"  />
                    </Col>
                </Row>
            </div>
            <div slot="footer" style="display: inline;margin-right: 10px">
                <Button type="error" size="large" @click="aa">立案处理</Button>
            </div>
            <div slot="footer" style="display: inline">
                <Button type="info" size="large" @click="aa">误报信息</Button>
            </div>
        </Modal>
        <Row type="flex" justify="end" style="margin-top: 25px">
            <Page :total="total" show-total @on-change="pageAction" />
        </Row>
    </div>
</template>

<script>
import { getSpvTransactionsByAoList } from '@/api/user'
export default {
  data () {
    return {
      formItem: {
        company: ''
      },
      total: 0,
      modal2: false,
      value7: '',
      value: '',
      value1: '',
      value2: ['2016-01-01', '2016-02-15'],
      columns12: [
        {
          title: '交易流水号',
          key: 'batch_number',
          align: 'center'
        },
        {
          title: '金额',
          key: 'money',
          align: 'center'
        },
        {
          title: '受理机构',
          key: 'acceptance_organization',
          slot: 'acceptance_organization',
          align: 'center'
        },
        {
          title: '交易类型',
          key: 'transaction_type',
          align: 'center'
        },
        {
          title: '交易状态',
          key: 'transaction_status',
          align: 'center'
        },
        {
          title: '卡号/客户编号',
          key: 'card_num',
          align: 'center'
        },
        {
          title: '客户名称',
          key: 'name',
          align: 'center'
        },
        {
          title: '商品种类',
          key: 'type',
          align: 'center'
        },
        {
          title: '油量',
          key: 'fuel',
          align: 'center'
        },
        // {
        //   title: '多次加油的次数',
        //   key: 'count_num',
        //   align: 'center'
        // },
        {
          title: '业务日期',
          key: 'business_time',
          align: 'center'
        },
        {
          title: '交易时间',
          key: 'transaction_time',
          align: 'center'
        },
        // {
        //   title: '石油公司名称',
        //   key: 'oil_company_name',
        //   align: 'center'
        // },
        {
          title: '单位',
          key: 'company',
          align: 'center'
        },
        {
          title: '石油公司',
          key: 'oil_companies',
          align: 'center'
        }
        // {
        //   title: '操作',
        //   slot: 'action',
        //   width: 150,
        //   align: 'center'
        // }
      ],
      data6: []
    }
  },
  methods: {
    async init (data) {
      getSpvTransactionsByAoList(data).then(ret => {
        this.data6 = ret.data.data.results
        this.total = ret.data.data.totalRecord
        console.log(this.total)
      })
    },
    search () {
      const data = {
        company: this.formItem.company
      }
      this.init(data)
    },
    aa () {
      this.modal2 = false
    },
    pageAction (current) {
      getSpvTransactionsByAoList({ pageNo: current, company: this.formItem.company }).then(ret => {
        this.data6 = ret.data.data.results
      })
    },
    exportData () {
      this.$router.push({
        name: 'yd'
      })
    }
    // show () {
    //   this.modal2 = true
    // }
  },
  mounted () {
    this.init()
  }
}
</script>

<style scoped>
    .ivu-table .demo-table-info-cell-name {
        background-color: #2db7f5;
        color: #fff;
    }
</style>
